<?php include( "templates/include/header.php" );
  include( "templates/include/adminHeader.php" );?>

      <div id="adminHeader">
        <h2>Administation de l'historique</h2>
        <p>Vous &ecirc;tes connect&eacute; en tant que <b><?php echo htmlspecialchars( $_SESSION['username']) ?></b>. <a href="admin.php?action=logout"?>Se D&eacute;connecter</a></p>
      </div>

      <h1>Le PDF</h1>

<?php if ( isset( $results['errorMessage'] ) ) { ?>
        <div class="errorMessage"><?php echo $results['errorMessage'] ?></div>
<?php } ?>


<?php if ( isset( $results['statusMessage'] ) ) { ?>
        <div class="statusMessage"><?php echo $results['statusMessage'] ?></div>
<?php } ?>

    <?php
      foreach( $results['history'] as $history ) {
      	if( isset( $history->id ) ) { ?>
      	  <a href="admin.php?action=editHistory&amp;historyId=<?php echo $history->id?>">Changer le PDF</a>
      	  <a href="admin.php?action=deleteHistory&amp;historyId=<?php echo $history->id?>">Supprimer le PDF</a>
      	  <?php if( isset( $history->file ) ) { ?>
            <embed src="<?php echo( $history->file ); ?>" width="100%" height="600px" />
          <?php }
        }
      }

      if( !$results['history'] ) { ?>
		<a href="admin.php?action=newHistory">Ajouter un PDF</a>
	  <?php } ?>
<?php
  include( "templates/include/adminFooter.php" );
  include( "templates/include/footer.php" ); ?>
